ferret,multiple model search -undefined method `aaf_index' for #<Class:>

Posted by jissy on Stack Overflow See other posts from Stack Overflow or by jissy
Published on 2010-04-16T06:57:18Z Indexed on 2010/04/16 10:43 UTC
Read the original article Hit count: 192

Filed under:

ferret,multiple model search -

I have 2 models A and B.I want to perform a text search by using 3 fields; title, description(part of A) and comment(part of B). Where I want to include the comment field to perform the ferret search.Then,what other changes needed.

    class A < ActiveRecord::Base
      has_one :b

    acts_as_ferret :fields => [:title, :description],
                 :additional_fields => [:comment_text]

 def comment_text
    return b.comment 
  end

In a_controller, i wrote:

@search = A.find_with_ferret(
  params[:st][:text_search],
  :limit => :all,
  :multi => [B]
).paginate :per_page =>10, :page=>params[:page]

The second mosel is given below:

class B < ActiveRecord::Base belongs_to :a

while using :multi[B] option with the find_with_ferret,the following error is getting:

undefined method `aaf_index' for #ClassName

© Stack Overflow or respective owner

Related posts about ruby-on-rails